perm filename VERCH.PN[UP,DOC] blob sn#663497 filedate 1982-06-11 generic text, type T, neo UTF8
User's Guide to VERCH

    VERCH is a program that can be used to change back and forth between
different versions of a Pascal program.  To convert from one version to
another, you run the program through VERCH, and it comments out blocks of
code that are not relevent to the current version, and uncomments blocks
that are, according to commands which are contained in special-format
comments in the code itself.  Thus both the input and output to VERCH are
compilable Pascal programs.

    The flags may also be set directly from the command line:

UNIX:
    VERCH Infile Outfile -flag1+ -flag2- -flag3+ strip
WAITS:
    R VERCH
    VERCH> Outfile←Infile/flag1+/flag2-/flag3+/strip

    A version command line begins with the characters "(*%" followed by
one of the following commands: SETT, SETF, SET?, IFT, IFF, ELSE, ENDC,
followed by a flag name.  Spaces and tabs can be used freely, and comments
can be added after the last part of the command.


(*% Sett S1 *)		set flag "S1" to "true"
(*% Setf S1 *)		set flag "S1" to "false"
(*% Set? S1 *)		get value of flag "S1" from user 
(*% Ift S1 *)		if flag "S1" true then don't comment out this block
(*% Iff S1 *)		if flag "S1" false then don't comment out this block
(*% Else *)		begin reverse block
(*% Endc *)	 	end of block
(*% Delete *)		Delete blocks instead of commenting them out
			(Also deletes all command lines.)
(*% Strip *)		Uncomment everything, no matter what the value of the
		        flags
(*% Nopage *) 		Delete page marks
(*% Kchars *)		To provide for Dec-10 compiler kludge, use "%" and "\" 
			as the commenting-out characters instead of "{" and "}" 

    If "T", "F", or "?" appear after a SETT, SETF, or SET? command, then
the version changer will replace it with the current value of the flag.
Thus you can tell when you look at a program what version is currently
active.  For instance, we can tell by the following line that the program
hasn't been run through the version changer yet, and thus the version "S1"
is still inactive:

        (*% SETT S1 F *)   

    A full-blown example:  suppose we wanted to change the Vax version of
a program to the S-1 version of the program.  Here is the program before
and after running it through VERCH:


BEFORE: ************************************************************

(*%SETF Vax T *)  
(*%IFT Vax *)
  program PTRANS (INPUT,OUTPUT);
(*%ELSE*)
{}
{  program PTRANS;}
{}
(*%ENDC*)
  begin
  end.

AFTER: *************************************************************

(*%SETF Vax F *)  
(*%IFT Vax *)
{  program PTRANS (INPUT,OUTPUT);}
(*%ELSE*)
  program PTRANS;
(*%ENDC*)
  begin
  end.

**********************************************************************

    Note that if we had used "SET?" instead of "SETF", the version changer
would have asked us what we wanted the flag set to.


    Other details:

    "AND" and "OR" can be used to concatenate IFF and IFT commands.  For
instance, after reading the following command, the version changer would
not comment out the block that followed if either flag were true:

    (*% IFT S1 OR IFT VAX *)

    Blocks may be nested.  The AND function is performed on nested blocks.
In other words, if any of the blocks containing a statement are "false"
blocks, the statement is commented out.

    Only the first 16 characters of a flag are significant.

    The original idea for the version-changer came from Dick Sites.

    This program depends on having at least two kinds of comments
characters which are distinguished, e.g. (* *), and { }, so that comments
may be nested at least one level deep.  This is contrary to the Pascal
Standard, which mandates that a right curly bracket be treated identically 
with a "*)", but most compilers support it.